package com.antgroup.seckill.business.utils;

import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;

import java.security.Key;
import java.security.SecureRandom;
import java.util.Base64;

/**
 * @author wangxy
 * @date 2024/7/28 09:22
 */
public class SecretKeyGeneratorUtil {

    private static final int KEY_SIZE = 256; // 256位密钥
    public static String generateSecretKey() {


        SecureRandom secureRandom = new SecureRandom();
            byte[] key = new byte[KEY_SIZE / 8];
            secureRandom.nextBytes(key);
            return Base64.getEncoder().encodeToString(key);

    }

    public static void main(String[] args) {
        String secretKey = generateSecretKey();
        System.out.println("Generated Secret Key: " + secretKey);
    }

}
